﻿using Abp.Application.Services.Dto;
using System;

namespace Camc.Quality.BomContrastive
{
    public class BomAnalysisDto : FullAuditedEntityDto<Guid>, IEquatable<BomAnalysisDto>
    {
        ///// <summary>
        ///// 物料代码
        ///// </summary>
        //public string MaterialNoBomDesign { get; set; } = "";

        ///// <summary>
        ///// 物料代码
        ///// </summary>
        //public string MaterialNoMake { get; set; } = "";
        /// <summary>
        /// 物料代码
        /// </summary>
        public Guid MaterialId { get; set; }
        /// <summary>
        /// 物料代码
        /// </summary>
        public string MaterialNo { get; set; } = "";
        /// <summary>
        /// 物料名称
        /// </summary>
        public string MaterialName { get; set; }
        /// <summary>
        /// 规格型号
        /// </summary>
        public string Model { get; set; } = "";
        /// <summary>
        /// 物料属性
        /// </summary>
        public string MaterialProperty { get; set; }
        /// <summary>
        /// 物料类别名称
        /// </summary>
        public string MaterialTypeName { get; set; }
        /// <summary>
        /// 主单位
        /// </summary>
        public string Unit { get; set; }
        /// <summary>
        /// 制造bom用量
        /// </summary>
        public int Unit1BomMake { get; set; }
        /// <summary>
        /// 制造bom用量
        /// </summary>
        public int Unit1BomDosage { get; set; }
        /// <summary>
        /// 差异
        /// </summary>
        public int Difference { get; set; }
        public DateTime CreationTime { get; set; }

        public bool Equals(BomAnalysisDto other)
        {
            if (other is null)
                return false;

            return this.MaterialNo == other.MaterialNo&&this.Model ==other.Model;
        }

        public override bool Equals(object obj) => Equals(obj as BomAnalysisDto);
        public override int GetHashCode() => (MaterialNo,Model).GetHashCode();
    }
}
